644c7ac7e87f22235df56660f9a949dba20a261a,OsmAnd/src/net/osmand/plus/activities/DownloadIndexActivity.java,DownloadIndexActivity,downloadFilesConfirmation,#,484
Before Change
for(DownloadEntry es : entriesToDownload.values()){
sz += es.sizeMB;
}
builder.setMessage(MessageFormat.format(getString(R.string.download_files_question), entriesToDownload.size(), sz));
builder.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
After Change
StatFs fs = new StatFs(dir.getAbsolutePath());
asz = (((long) fs.getAvailableBlocks()) * fs.getBlockSize()) / (1 << 20);
}
if(asz != -1 && asz < sz ){
Toast.makeText(this, getString(R.string.download_files_not_enough_space, sz, asz), Toast.LENGTH_LONG).show();
} else {
Builder builder = new AlertDialog.Builder(this);
if (asz - sz < 20) {
builder.setMessage(MessageFormat.format(getString(R.string.download_files_question_space), entriesToDownload.size(), sz,
asz));
} else {
builder.setMessage(MessageFormat.format(getString(R.string.download_files_question), entriesToDownload.size(), sz));
}
builder.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
@Override